A computer graphic image is typically composed of a number of objects. Objects are rendered onto a background image. Portions of the objects can be defined as transparent to enable overlay of the objects onto a variety of later defined background images. During rendering, the object may be combined with previously generated objects (e.g., to reuse a complex background) using compositing techniques.
Compositing is the combining of two images by overlaying or blending them. In a composited image, the value of each pixel is computed from the component images. One technique typically used is an overlay in which the pixels of the foreground image must be given transparency values as well as whatever other values the pixels may have, such as color information. Therefore, in the composited image, a pixel's value is taken from the background image unless the foreground image has a nontransparent value at that point. If the foreground image has a nontransparent value at that point, the value is taken form the foreground image. Multiple images may also be blended resulting in pixel values that are linear combinations of the values of the multiple component pixels.
Problems arise, however, when drawing an image which contains transparent elements. As an example, consider rendering an image of a tree. While it is desired to render only the tree, the tree picture is typically stored in a rectangular image, not a tree-shaped image. Thus, some method is required to identify the parts of the image that are not to be considered part of the tree, and then these parts, to be called the transparent parts, are to have no effect on the image drawn. Thus, when drawing the tree image, the display hardware will draw the non-transparent parts of the tree and not draw the transparent parts.
Two common compositing techniques used in the prior art to render an object onto a transparent background are alpha-channel compositing and chroma keying. Alpha-channel compositing solves the problem of drawing a transparent image by storing an alpha channel which utilizes an alpha value to encode the transparency of each pixel. However, this requires additional memory to be allocated in addition to that allocated for the image. Chroma keying, however, does not require additional storage space because this technique represents the transparent areas of the image by a specific color, known as the chroma color. With chroma keying, the hardware compares each pixel with the chroma color, and if they are identical, does not draw the pixel on the display. These techniques have been expanded to be applicable to texture mapping. Sophisticated computer graphic renderings typically include patterns or images that are mapped to a surface. This approach is known as texture mapping; the pattern or image is called a texture map, and its individual elements are often called texels. The texture map resides in its own (u, v) texture coordinate space. At each rendered pixel, selected texels are used either to substitute for or to scale one or more of the surface's material properties, such as its diffuse color components. One pixel is often covered by a number of texels. It should be noted that chroma keying as described above only works if the image is point sampled; i.e., one texel is read for each pixel displayed.
Prior art rendering as performed by chroma keying typically is applied on unfiltered and unfogged textures. However, texture maps are generally filtered because improving the appearance of texture-mapped polygons requires antialiasing texture mapping. There are many well-known techniques for antialiasing texture mapping. One such technique employs bilinear filtering which utilizes the colors of the four nearest texels and weighs the colors together to acquire a filtered representation of that texture. For a further description of bilinear filtering, see Wolberg, George, Digital Image Warping, IEEE Computer Society Press (1990) pp. 57-61.
However, a problem arises if the texture map is to be filtered. Instead of reading a single texel at a time and using that texel, multiple texels are read and filtered, and the filtered result is then displayed. This results in three scenarios: (a) all texels read are the chroma color; (b) no texels read are the chroma color; or (c) some texels read are the chroma color. In the case where all texels read are the chroma color, the filtered result will generally be the chroma color, and the prior art will properly not draw that texel. In the case where none of the texels read are the chroma color, no transparent texels are involved, the chroma color will not be a likely result of filtering, and the prior art will properly draw that texel.
In the case where some texels read are the chroma color, the aforementioned problem arises. In this case, the texel should be considered partially transparent (as it has some transparent texels and some opaque texels) but what happens with the prior art is that the texels and the chroma color will be filtered together and, since the resulting color is very unlikely to match the chroma color, the filtered result displayed. Thus, the act of filtering changes the colors at the boundary of the texture map, mixing the image colors with the colors of the surrounding background texels, so that the background texels in the immediate vicinity of the image no longer match the chroma color. This causes a border or outline to appear around the rendered image so that if the chroma color is blue, as it often is, the resulting image will display a blue fringe. Consequently, it is desirable to perform chroma keying of filtered textures.
The technique of "fogging" or adding a fog effect to an image displayed is popular in video games to generate fog or smoke special effects. Fogging adds an additional level of complexity to renderings.